<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>卡券核销</title>
		<link rel="stylesheet" type="text/css" href="Admin/Webroot/css/detail/default.css" />
		<link rel="stylesheet" type="text/css" href="Admin/Webroot/css/detail/component.css" />
		<link rel="stylesheet" type="text/css" href="Admin/Webroot/css/amazeui.min.css"/>
		<link rel="stylesheet" type="text/css" href="Admin/Webroot/css/hy.admin.css"/>
		<script src="Admin/Webroot/js/detail/modernizr.custom.js"></script>
		
	</head>
	<body>
		<div class="am-g">
			 	<div style="height:100px;" ></div>
      <div class="am-u-md-10 am-u-end">
			<div class="am-form am-form-horizontal ">
				<div class="am-form-group">
					<label for="user-name" class="am-u-sm-3 am-form-label">Code</label>
					<div class="am-u-sm-6">
						<input type="text" name="codes" id="codes" value="" placeholder="">
					</div>
					<div class="am-u-sm-3">
					</div>
				</div>
				<div class="am-form-group">
					<div class="am-u-sm-9 am-u-sm-push-3">
						<button type="button" onClick="cancelCode()" id="btn" class="am-btn am-btn-primary ">核销</button>
						<input type="hidden" data-modal="modal-1" class="md-trigger" id="input"></input>
					</div>
				</div>
			</div>
	</div>
      
    </div>
   <div class="md-modal md-effect-1" id="modal-1">
			<div class="md-content">
				<h3>核销成功</h3>
				<div>
					<table>
						<tr>
							<td><strong>门票类型:</strong></td>
							<td><strong id="card_name"></strong</td>
						</tr>
					</table>
					<div style="height:10px;"></div>
					<div>
						<input value="" name="id" id="id" type="hidden"></input>
					<button style="	float: right;margin-right: 47px;" class="md-close">确认</button>
					</div>
				</div>
			</div>
		</div>
   <div class="md-overlay"></div>
   	<script src="Admin/Webroot/js/jquery-1.7.2.min.js"></script>
    <script src="Admin/Webroot/js/amazeui.min.js"></script>
		<script src="Admin/Webroot/js/detail/classie.js"></script>
		<script src="Admin/Webroot/js/detail/modalEffects.js"></script>
		<script>
			// this is important for IEs
			var polyfilter_scriptpath = 'ws/Admin/Webroot/js/detail/';
		</script>
		<script src="Admin/Webroot/js/detail/cssParser.js"></script>
		<script src="Admin/Webroot/js/detail/css-filters-polyfill.js"></script>
		<script type="text/javascript">
			var isSend = false;
		function cancelCode(){
				this_btn=$("#btn");
				if(this_btn.attr('hy-disabled'))
				{
					  return;
				}
				var codes = $("#codes").val();
				if(codes==""||codes==undefined||codes==null){
					alert("请输入Code值");
					return false;
				}
				var data = {
					codes:codes
				};
				var url = "index.php?g=mobile&m=suipai&a=cancelCode";
				this_btn.attr('hy-disabled',1)
	            this_btn.removeClass('am-btn-primary');
				$.post(url,data,function(res){
					this_btn.addClass('am-btn-primary');
					this_btn.removeAttr('hy-disabled');
					if(res.error==0){
						$("#card_name").html(res.result.card.card_name);
						$("#input").click();
						$("#codes").val("");
//						alert(res.content);
					}else{
						alert(res.content);
					}
				},"json");
				
				
				
//				var url = "index.php?g=mobile&m=suipai&a=get_code";
//	           this_btn.attr('hy-disabled',1)
//	           this_btn.removeClass('am-btn-primary');
//			 	$.post(url,data,function(result){
//					 	this_btn.addClass('am-btn-primary');
//					 	this_btn.removeAttr('hy-disabled');
//						if(result.error==0){
//							$("#card_name").html(result.codeData.card.card_name);
//							$("#input").click();
//						}else{
//							alert(result.content);
//						}
//					},"json");
		}
		function cancel(){
//			var codes = $("#codes").val();
//			if(codes==""||codes==undefined||codes==null){
//				alert("请输入Code值");
//				return false;
//			}
//			var data = {
//				codes:codes
//			};
//			var url = "index.php?g=mobile&m=suipai&a=cancelCode";
//			$.post(url,data,function(res){
//				if(res.error==0){
//					$("#codes").val("");
//					$(".md-close").click();
//					alert(res.content);
//				}else{
//					alert(res.content);
//				}
//			},"json");
		}
		
	 $('#codes').bind('keyup', function(event) {
        if (event.keyCode == "13") {
            //回车执行查询
           $('#btn').click();
        }
    });
			
			
		
		</script>
	</body>
</html>
